Posts

Spring Boot

44. What is Spring Boot?  Spring Boot makes creating production-grade applications and services powered by the Spring Framework absolutely easy. Spring Boot with its opinionated view of the Spring platform enables new and existing users to quickly get up and running Spring applications quickly.  Spring Boot provides a range of non-functional features, such as embedded servers, security, metrics, health checks, and externalized configuration that are common to large classes of projects. In addition, Spring Boot favours convention over configuration. Therefore, you can develop the application without worrying about any XML configuration.  45. Why will you use Spring Boot in your application?  Spring-based applications have a lot of configurations. For example, if you use Spring MVC, you need to add configurations, such as component scan, dispatcher servlet, view resolver, and Web JARs.  Spring Boot looks at only two things. One, the JARs available on the classpath. S

Spring Data Access

42. What is JdbcTemplate?  Spring simplifies handling database access with the Spring JDBC Template exposed through the JdbcTemplate class. Spring JDBC Template simplifies the use of JDBC and helps to avoid common errors. Spring JDBC Template is responsible for executing the core JDBC workflow. Application code only needs to provide SQL and retrieve results. Spring JDBC Template executes SQL queries or updates and initiates iteration over ResultSet objects. It also catches JDBC exceptions and translates them to the generic, more informative exception hierarchy.  43. Why use an embedded database? Name few embedded databases that Spring supports natively.  Spring 3 introduced the support for embedded Java database engines. The embedded databases are very useful during the development phase of the project. They provide almost the same features as their standalone version, and at the same time are lightweight, have a quick start time, and extremely fast. Being fast t

Spring Model View Controller (MVC)

33. What is Spring MVC framework?  Spring Model View Controller (MVC) is the Web module of the Spring Framework. It provides a rich functionality for building robust Web Applications. The Spring MVC Framework is architected and designed in such a way that every piece of logic and functionality is highly configurable.  The MVC framework of Spring is request-driven and is designed around a central servlet, called DispatcherServlet that dispatches requests to controllers.  Spring’s DispatcherServlet is completely integrated with Spring IoC container and allows you to use every other feature of Spring.  34. What is DispatcherServlet?  In Spring MVC, the client sends a request to the Web container in the form of HTTP request. This incoming request is intercepted by the Front controller which is the DispatcherServlet and it then tries to find out appropriate handler mappings. The DispatcherServlet dispatches the request to the appropriate controller with the help of handler mappin

Spring Aspect Oriented Programming (AOP)

29. What is AOP?  AOP that stands for Aspect Oriented Programming is a way to modify existing classes in a code base to change their behavior based on rules defined separately. This modification can be done before the classes are packaged into a JAR or WAR, or can happen dynamically while the code is being loaded.  Rather than finding all the points of code that you want to modify in the source code and hard coding them, you just define the rules for how to find points of interest in the code and what changes you would like to do to them. These rules are called aspects – the A of AOP.  30. What is Aspect?  Consider a use case where an end user enters login and password, goes to the home page, performs some action, and returns back.  The implementation code would typically consist of an HTML client that in turn would send the message to a servlet, which would perform the action. Now as you implement additional features, such as logging and transacting, your implementation c

Spring Annotations

26. Are annotations better than XML for configuring Spring?  Spring supports both XML and Annotation based configuration, and both complement each other. It all depends on the requirements and the developer’s personal opinion on which of the configurations better suits him.  Annotations provide a lot of context in their declaration, leading to shorter and more concise configuration. All the information is in a single source file. When the class changes, you don’t have to worry about the XML file.  However, XML excels at wiring up components without touching their source code or recompiling them. XML clearly separates the Plain Old Java Object (POJO) and its behavior.  No matter the choice, Spring can accommodate both styles and even mix them together.  27. What is annotation-based container configuration?  Starting with Spring 2.5, annotation support has been added to the Spring Framework. It is now possible to configure Beans using annotations.  XML configurations are